/*
 * Copyright © 2022 XXXXXXXXX
 * @Author: zhangxiang
 * @Date: 2022-06-06 15:03:23
 * @LastEditors: zhangxiang
 * @LastEditTime: 2022-11-23 14:49:52
 * @Description: 
 * 
 */

#app {
  // 主容器
  .main-container {
    min-height: 100%;
    transition: margin-left 0.28s;
    margin-left: $sideBarWidth;
    position: relative;
  }

  // sidebar容器
  .sidebar-container {
    transition: width 0.28s;
    width: $sideBarWidth !important;
    background-color: $sideBarBg;
    height: 100%;
    position: fixed;
    font-size: 0px;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1001;
    overflow: hidden;
    box-shadow: $sideBarShadow;

    // reset element-ui css
    .horizontal-collapse-transition {
      transition: 0s width ease-in-out, 0s padding-left ease-in-out,
        0s padding-right ease-in-out;
    }

    .scrollbar-wrapper {
      overflow-x: hidden !important;
    }

    .el-scrollbar__bar.is-vertical {
      right: 0px;
    }

    .el-scrollbar {
      height: 100%;
    }

    &.has-logo {
      .el-scrollbar {
        height: calc(100% - 80px);
      }
    }

    .is-horizontal {
      display: none;
    }

    a {
      display: inline-block;
      width: 100%;
      overflow: hidden;
    }

    .svg-icon {
      margin-right: 15px;
    }

    .sub-el-icon {
      margin-right: 12px;
      margin-left: -2px;
    }

    .el-menu {
      border: none;
      height: 100%;
      width: 100% !important;

      div {
        overflow: hidden;
      }
    }

    // 非折叠菜单
    .submenu-title-noDropdown {
      margin: 10px 25px 0 25px;
      padding: 0 0 0 $menuPaddingLeftSide !important;
      height: $menuItemHeight;
      line-height: $menuItemHeight;
      border-radius: 4px;
      color: $menuText !important;
      font-size: $menuTextSize;
      &.is-active {
        color: $menuActiveText !important;
        background-color: $menuActiveBg !important;
      }
      &:hover {
        color: $menuActiveText !important;
        background-color: $menuHover !important;
      }
    }

    // 折叠菜单
    .el-submenu {
      margin: 10px 25px 0px 25px;
      &.is-opened {
        background-color: $nestMenuBoxBg !important;
        border-radius: 4px;
      }
      // 折叠菜单-头部
      .el-submenu__title {
        height: $menuItemHeight;
        line-height: $menuItemHeight;
        border-radius: 4px;
        font-size: $menuTextSize;
        padding-left: $menuPaddingLeftSide !important;
        padding-right: $menuPaddingRightSide !important;
        &:hover {
          background-color: $menuHover !important;
          color: $menuActiveText !important;
          .el-submenu__icon-arrow {
            color: $menuActiveText;
          }
        }
        // 右侧下拉箭头
        .el-submenu__icon-arrow {
          right: $menuPaddingRightSide;
        }
      }
      // 折叠菜单-头部 active
      &.is-active > .el-submenu__title {
        background-color: $subMenuTitleActiveBg !important;
        color: $menuActiveText !important;
        // 右侧下拉箭头
        .el-submenu__icon-arrow {
          color: $menuActiveText;
        }
      }
      // 折叠菜单-子菜单外层
      .nest-menu {
        &:first-child {
          padding-top: 5px;
        }
        .el-submenu {
          margin: 0px 0px 0px 0px;
          padding-bottom: 5px;
          &.is-opened {
            background-color: $nestMenuBoxBg !important;
          }
          .el-submenu__title {
            padding-left: 36px !important;
            font-size: $subMenuTextSize;
          }
          .el-menu-item {
            padding-left: 50px !important;
            // 左侧圆圈
            &::before {
              content: "";
              position: absolute;
              top: 16px;
              left: 36px;
              border-radius: 50%;
              width: 4px;
              height: 4px;
              background: #ffffff;
            }
          }
        }
      }
      // 折叠菜单-子菜单
      .el-menu-item {
        background-color: $subMenuBg !important;
        padding-left: 36px !important;
        margin-bottom: 5px;
        height: $menuItemHeight;
        line-height: $menuItemHeight;
        font-size: $subMenuTextSize;

        &.is-active {
          background-color: $subMenuActiveBg !important;
          color: $subMenuActiveText !important;
        }

        &:hover {
          background-color: $subMenuHover !important;
          color: $subMenuActiveText !important;
        }
      }
    }
  }

  // sider隐藏
  .hideSidebar {
    .sidebar-container {
      width: 54px !important;
    }

    .main-container {
      margin-left: 54px;
    }

    .submenu-title-noDropdown,
    .el-menu-item {
      margin: 0;
      padding: 0 15px !important;
      height: $menuItemHeight;
      line-height: $menuItemHeight;
      border-radius: 0;
    }

    .submenu-title-noDropdown {
      padding: 0 !important;
      position: relative;

      .el-tooltip {
        padding: 0 !important;

        .svg-icon {
          margin-left: 20px;
        }

        .sub-el-icon {
          margin-left: 19px;
        }
      }
    }

    .el-submenu {
      overflow: hidden;
      margin: 0;

      & > .el-submenu__title {
        padding: 0 !important;

        .svg-icon {
          margin-left: 20px;
        }

        .sub-el-icon {
          margin-left: 19px;
        }

        .el-submenu__icon-arrow {
          display: none;
        }
      }
    }

    .el-menu--collapse {
      .el-submenu {
        & > .el-submenu__title {
          & > span {
            height: 0;
            width: 0;
            overflow: hidden;
            visibility: hidden;
            display: inline-block;
          }
        }
      }
    }
  }

  .el-menu--collapse .el-menu .el-submenu {
    min-width: $sideBarWidth !important;
  }

  // mobile responsive
  .mobile {
    .main-container {
      margin-left: 0px;
    }

    .sidebar-container {
      transition: transform 0.28s;
      width: $sideBarWidth !important;
    }

    &.hideSidebar {
      .sidebar-container {
        pointer-events: none;
        transition-duration: 0.3s;
        transform: translate3d(-$sideBarWidth, 0, 0);
      }
    }
  }

  .withoutAnimation {
    .main-container,
    .sidebar-container {
      transition: none;
    }
  }
}

// when menu collapsed
.el-menu--vertical {
  & > .el-menu {
    background-color: $sideBarBg !important;
    .svg-icon {
      margin-right: 15px;
    }
    .sub-el-icon {
      margin-right: 12px;
      margin-left: -2px;
    }
  }

  .nest-menu .el-submenu > .el-submenu__title,
  .el-menu-item {
    &:hover {
      background-color: $subMenuHover !important;
      color: $subMenuActiveText !important;
    }
  }

  // the scroll bar appears when the subMenu is too long
  > .el-menu--popup {
    max-height: 100vh;
    overflow-y: auto;

    &::-webkit-scrollbar-track-piece {
      background: #d3dce6;
    }

    &::-webkit-scrollbar {
      width: 6px;
    }

    &::-webkit-scrollbar-thumb {
      background: #99a9bf;
      border-radius: 20px;
    }
  }
}
